package com.cy.service.impl;


import com.cy.dao.StuMapper;
import com.cy.pojo.Admi;
import com.cy.pojo.PageBean;
import com.cy.pojo.Show;
import com.cy.pojo.UserBean;
import com.cy.service.Showservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class ShowserviceImpl implements Showservice {
    @Autowired
    private StuMapper stuMapper;


    @Override//查询所有
    public ArrayList<Show> selectShowAll() {
        return  stuMapper.selectShowAll();
    }


    @Override//分页查询
    public PageBean<Show> selectShowPage(int currentPage, int pagesize) {
        int begin=(currentPage-1)*pagesize;
        int size=pagesize;

        ArrayList<Show> rows = stuMapper.selectShowPage(begin, size);
        int totalCount = stuMapper.selectTotalCount(size);
        PageBean<Show>pageBean=new PageBean<>(rows,totalCount);
        return pageBean;
    }

    @Override//查询指定商品
    public PageBean<Show> selectShowNames(String names) {
        ArrayList<Show> rows = stuMapper.selectShowNames(names);
        int totalCount = stuMapper.selectselectCount(names);
        PageBean<Show>pageBean=new PageBean<>(rows,totalCount);
        return  pageBean;
    }

    @Override//分类查询
    public PageBean<Show> selectShowType(String type) {
        ArrayList<Show> rows = stuMapper.selectShowType(type);
        int totalCount = stuMapper.selectselectCount1(type);
        PageBean<Show>pageBean=new PageBean<>(rows,totalCount);
        return  pageBean;
    }

    @Override
    public ArrayList<Admi> selectZhuce() {

        return stuMapper.selectZhuce();
    }

    @Override
    public void deleteShowNames(String name,String seller) {
        stuMapper.deleteShowNames(name,seller);
    }


    @Override
    public void insertxingxi(String name, String password) {
        stuMapper.insertxingxi(name,password);
    }

    @Override
    public void deleteZhuce(String name, String password) {
        stuMapper.deleteZhuce(name,password);
    }

    @Override
    public ArrayList<Show> selectSellerNames(String seller) {
        return stuMapper.selectSellerNames(seller);
    }

    @Override
    public void insertshow(String names, int prices, String sellers, int numbers, String type) {
        stuMapper.insertshow(names,prices,sellers,numbers,type);
    }

    @Override
    public UserBean selectXingxi(String name, String password) {
        return stuMapper.selectXingxi(name,password);
    }

    @Override
    public void insertZhuce(String name, String password, String password1) {
        stuMapper.insertZhuce(name,password,password1);
    }
}
